import api from '../api'

const bookReader = {
  namespaced: true,
  state: {
    content: []
  },
  mutations: {
    gotChapterData (state, data) {
      state.content = []
      state.content.push(data)
    }
  },
  actions: {
    getChapterData ({ commit }, value) {
      api.getChapterContent(value)
        .then(data => {
          console.log(data)
          commit('gotChapterData', data)
        })
        .catch(err => {
          console.log(err)
        })
    }
  },
  getters: {}
}

export default bookReader
